/*                                  ATELIER                                   */

/* %%LICENSE_TAG%%                                                            */
package edu.gmu.view.canvas;

import javax.swing.JPanel;

/**
 * An AbstractLayer implements the Layer interface and provides default
 * implementations for the abstract methods.  This class should be
 * extended by subclasses to provide specific behavior.
 * 
 * @author  James H. Pope
 * @version $Revision:$ $Date:$
 */
public abstract class AbstractLayer implements Layer
{
    /**
     * Name of this Layer - must be unique.
     */
    protected String name = "null";
    
    /**
     * Flag if this Layer should be displayed.
     */
    protected boolean visible = true;

    /**
     * controlPanel
     */
    protected JPanel controlPanel = null;
    
    
    /**
     * Create new AbstractLayer with default values.
     */
    public AbstractLayer()
    {
        this( "null" );
    }
    
    /**
     * Create new AbstractLayer with specified values.
     * 
     * 
     * @param name
     */
    public AbstractLayer( String name )
    {
        this.name = name;
        this.controlPanel = new JPanel();
    }
    
    /**
     * Set this objects visible property.
     * 
     * @param visible
     */
    public void setVisible( boolean visible )
    {
        this.visible = visible;
    }
    
    /**
     * Get this objects visible property.
     * 
     * @return boolean true to draw (i.e. paintToLayer)
     */
    public boolean getVisible()
    {
        return this.isVisible( );
    }
    
    /**
     * Get this objects visible property.
     * 
     * @return boolean true to draw (i.e. paintToLayer)
     */
    public boolean isVisible()
    {
        return this.visible;
    }
    
    /**
     * Sets name for the Layer.
     * 
     * @param name
     */
    public void setName( String name )
    {
        this.name = name;
    }
    
    /**
     * Gets name from the Layer.
     * 
     * @return String name
     */
    public String getName( )
    {
        return this.name;
    }

    /**
     * Sets controlPanel.
     *
     * @param controlPanel
     */
    public void setControlPanel( JPanel controlPanel )
    {
        this.controlPanel = controlPanel;
    }

    /**
     * Gets controlPanel
     *
     * @return controlPanel
     */
    public JPanel getControlPanel( )
    {
        return this.controlPanel;
    }
    
}

/*                                  ATELIER                                   */